Repository navigation
Conversation
|
Nenhum arquivo coberto por testes foi alterado nesta PR. |
Verificação ao vivo do gateO gate ligado aqui ( |
Turns on couve's --fail-on-low-coverage gate. The couve call is wrapped instead of run directly, because a failing step aborts immediately and would skip the comment-posting step — the result is captured into COVERAGE_OK and the actual exit 1 is deferred to a final step, so the coverage comment (showing exactly which lines are uncovered) always posts before the job goes red. Also excludes spec/support/ from SimpleCov tracking: test-support code (matchers, helpers) is exercised by the specs that use it, not covered on its own, and gating on it would incentivize test-for-a-test specs that verify nothing about br_danfe's actual behavior. Same reasoning facil123 documents in docs/padroes-de-programacao/testes-automatizados/o-que-nao-cobrir.md. This PR's own diff only touches this workflow file and spec_helper.rb, neither tracked by coverage, so it passes its own gate cleanly. Backfilling specs for the 5 pre-existing product-code gaps is separate follow-up work. Refs #283 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nally disabled) Removes header.rb's width_box, dead since PR #159 (2021) replaced its only bounding_box call site with individual text_box/move_down calls without removing the method itself. Adds specs for the method_missing/respond_to_missing? delegation fallback in the 3 Document wrapper classes (nfce_lib, cce_lib, nfe_lib) - each mutation-tested locally to confirm it fails when the real `super` fallback is broken. Excludes lib/prawn/ from SimpleCov, alongside the existing spec/support/ exclusion: it's a Prawn-internals monkey-patch, not br_danfe's own product logic. The nfe_lib delegation spec is deliberately commented out in this commit to prove the coverage gate (PR #286) actually catches a real gap on live CI, not just locally. Follow-up commit re-enables it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
e3daf63 to
ef9dba6
Compare
|
Closing together with #285 in favor of #289 — full reasoning over there. On the gate specifically: with octocov it becomes one line ( We're starting #289 without a gate on purpose; turning it on later is config, not a new flow. |
Resumo
Terceira PR da série de migração qlty → couve (empilhada sobre #285). Liga o gate
couve --fail-on-low-coverage: a partir desta PR, qualquer PR cujo diff toque uma linha não coberta reprova o CI, com o comentário de cobertura mostrando exatamente qual arquivo/linha.O que muda
.github/workflows/config.yml:--fail-on-low-coveragenocouve, que é o que de fato liga o gate (sem ele, o couve sempre sai com 0 independente da cobertura).couvedeixa de rodar direto — é envolvida numif/then/elseque captura sucesso/falha emCOVERAGE_OKvia$GITHUB_ENV. Necessário porque um step que falha aborta na hora (o shell da Action já roda comset -e), o que puxaria o step de comentário junto e o dev veria um X vermelho sem saber por quê.exit 1quandoCOVERAGE_OK == 'false'— assim o comentário de cobertura sempre posta antes do job ficar vermelho.spec/spec_helper.rb— excluispec/support/do SimpleCov (add_filter '/spec/support/'). Código de suporte de teste (matchers, helpers) é exercitado pelas specs que o usam, não coberto por si só; sem essa exclusão,spec/support/have_same_content_of.rb(hoje em 44%) reprovaria a próxima PR que só tocasse esse helper por motivo nenhum relacionado à mudança real. Mesmo raciocínio documentado emdocs/padroes-de-programacao/testes-automatizados/o-que-nao-cobrir.mddo facil123.O que NÃO muda
document.rb×3 com fallback demethod_missing/respond_to_missing?,nfce_lib/header.rbcom uma branch real de layout, elib/prawn/font_metric_cache.rb, um monkey-patch interno do Prawn). Backfill dessas specs é escopo de uma quarta PR, separada.config.ymlespec_helper.rb, nenhum dos dois rastreado por cobertura — confirmado localmente simulando o diff desta PR contra o coverage.json real.masternão tem nenhuma regra de proteção (protected: false), então um check vermelho não impede tecnicamente o merge, só sinaliza. Configurar isso é uma decisão separada, fora do escopo desta PR.Plano de teste
bundle exec rspeclocal: suíte verde,spec/support/confirmado fora docoverage.jsonbundle exec rubocop --display-cop-names --parallellocal: sem ofensasconfig.yml+spec_helper.rb) rodado através decc-test-reporter+couve --fail-on-low-coverage→ passa limpo (nenhum arquivo coberto alterado)couve --fail-on-low-coveragereprova corretamente (couve: coverage below 100% in ...), e o relatório continua sendo escrito mesmo com a falha🤖 Generated with Claude Code